package com.orange.res;

import com.orange.engine.Engine;
import com.orange.engine.device.Device;

public class ResManager {

	// ===========================================================
	// 单例处理
	// ===========================================================

	private static ResManager mResManager = null;

	public static ResManager getInstance() {
		return mResManager;
	}
	
	public static ResManager init(Engine pEngine) {
		if (mResManager == null) {
			mResManager = new ResManager(pEngine);
		}
		return mResManager;
	}

	// ===========================================================
	// 变量
	// ===========================================================

	private MusicRes mMusicRes;
	private SoundRes mSoundRes;
	private RegionRes mRegionRes;

	// ===========================================================
	// 构造
	// ===========================================================
	public ResManager(Engine pEngine) {
//		this.mMusicRes = new MusicRes(pContext, pEngine.getMusicManager());
//		this.mSoundRes = new SoundRes(pContext, pEngine.getSoundManager());
//		this.mRegionRes = new RegionRes(pContext, pEngine.getTextureManager());
		this.mMusicRes = new MusicRes(Device.getDevice().getFileManage(), pEngine.getMusicManager(), Device.getDevice().getMusicFactory());
		this.mSoundRes = new SoundRes(Device.getDevice().getFileManage(), pEngine.getSoundManager(),Device.getDevice().getSoundFactory());
		this.mRegionRes = new RegionRes(Device.getDevice().getFileManage(), pEngine.getTextureManager());
	}

	public MusicRes getMusicRes() {
		return mMusicRes;
	}

	public SoundRes getSoundRes() {
		return mSoundRes;
	}

	public RegionRes getRegionRes() {
		return mRegionRes;
	}


}
